package com.alipay.benchmark;

/**
 *
 * ops/sec    = 400,662,635
 *  latency ns = 2.496
 * Created by crazytime on 14-3-1.
 */
public class SingleMaxMark {
    public static void main(String[] args) {
        SingleMaxMark mark=new SingleMaxMark();
        mark.testMark();
    }

    private  long ITERATIONS = 1000L * 1000L * 100L;

    public SingleMaxMark(){

    }

    public SingleMaxMark(int ITERATIONS){
        this.ITERATIONS=ITERATIONS;
    }

    public void testMark(){
        final long start = System.nanoTime();

        long i = 0;
        while (i < ITERATIONS) {
            i++;
        }

        final long duration = System.nanoTime() - start;

        final long ops = (ITERATIONS * 1000L * 1000L * 1000L) / duration;
        System.out.format("ops/sec    = %,d\n", ops);
        System.out.format("latency ns = %.3f%n", duration / (float)(ITERATIONS) );
    }


}
